package fourEightDays;

import java.util.Scanner;

public class Day11 {
    public int getLCA(int a, int b) {
        // write code here
        while (a != b) {
            if (a > b) {
                a /= 2;
            } else {
                b /= 2;
            }
        }
        return a;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextInt()) { // 注意 while 处理多个 case
            int n = in.nextInt();
            // 思路：使用二进制右移位按位与
            int maxCount = 0;
            int count = 0;
            for (int i = 0; i < 32; i ++) {
                if (((n >> i) & 1) == 1) {
                    count ++;
                } else {
                    if (count > maxCount) {
                        maxCount = count;
                    }
                    count = 0;
                }
            }
            System.out.println(maxCount);
        }
    }
}
